﻿using System;
using System.Collections.Generic;
using BusinessLayer.Objects;
using BusinessLayer.Tools;

namespace BusinessLayer.EnumsAndContainers
{
    /// <summary>
    /// Contains all projects properties
    /// </summary>
    public class DeployableProjectsContainer
    {

        /// <summary>
        /// Gets the collection of projects properties for specified target system.
        /// </summary>
        /// <param name="targetSystem">One of value from <see cref="TargetSystem"/> enum.</param>
        /// <param name="solutionPath">Absolute path to solution folder.</param>
        /// <returns>List of all projects with their properties.</returns>
        public static List<DeployableProject> GetProjectsInformation(TargetSystem targetSystem, string solutionPath)
        {
            switch (targetSystem)
            {
                case TargetSystem.Test:
                {
                    return TestServerProjects(solutionPath);
                }
                case TargetSystem.AzureERP:
                {
                    return AzureERPProjects(solutionPath);
                }
                    /*case TargetSystem.AzureCT:
                {
                    return AzureCTDictionary;
                }*/
                default:
                {
                    return null;
                }
            }

        }

        /// <summary>
        /// Gets project properties for Minsk test server.
        /// </summary>
        /// <param name="solutionPath">Absolute path to solution folder.</param>
        /// <returns>List of all projects with their real properties.</returns>
        private static List<DeployableProject> TestServerProjects(string solutionPath)
        {
            return new List<DeployableProject>
            {
                new DeployableProject
                {
                    ProjectName = "AdministrativeWS",
                    PublishProfile = "DeployTest.pubxml",
                    ProjectPath =
                        string.Concat(solutionPath,
                            EnumsExtender.GetDescription((Project) Enum.Parse(typeof (Project), "AdministrativeWS"))),
                    UserName = "",
                    Password = ""
                },
                new DeployableProject
                {
                    ProjectName = "ClientCore",
                    PublishProfile = "DeployTest.pubxml",
                    ProjectPath =
                        string.Concat(solutionPath,
                            EnumsExtender.GetDescription((Project) Enum.Parse(typeof (Project), "ClientCore"))),
                    UserName = "",
                    Password = ""
                },
                new DeployableProject
                {
                    ProjectName = "IsoCore",
                    PublishProfile = "DeployTest.pubxml",
                    ProjectPath =
                        string.Concat(solutionPath,
                            EnumsExtender.GetDescription((Project) Enum.Parse(typeof (Project), "IsoCore"))),
                    UserName = "",
                    Password = ""
                },
                new DeployableProject
                {
                    ProjectName = "CustomerCore",
                    PublishProfile = "DeployTest.pubxml",
                    ProjectPath =
                        string.Concat(solutionPath,
                            EnumsExtender.GetDescription((Project) Enum.Parse(typeof (Project), "CustomerCore"))),
                    UserName = "",
                    Password = ""
                },
                new DeployableProject
                {
                    ProjectName = "CustomerWS",
                    PublishProfile = "DeployTest.pubxml",
                    ProjectPath =
                        string.Concat(solutionPath,
                            EnumsExtender.GetDescription((Project) Enum.Parse(typeof (Project), "CustomerWS"))),
                    UserName = "",
                    Password = ""
                },
                new DeployableProject
                {
                    ProjectName = "eAccounts",
                    PublishProfile = "DeployTest.pubxml",
                    ProjectPath =
                        string.Concat(solutionPath,
                            EnumsExtender.GetDescription((Project) Enum.Parse(typeof (Project), "eAccounts"))),
                    UserName = "",
                    Password = ""
                },
                new DeployableProject
                {
                    ProjectName = "PBS_ERP_WebApi",
                    PublishProfile = "DeployTest.pubxml",
                    ProjectPath =
                        string.Concat(solutionPath,
                            EnumsExtender.GetDescription((Project) Enum.Parse(typeof (Project), "PBS_ERP_WebApi"))),
                    UserName = "",
                    Password = ""
                },
                new DeployableProject
                {
                    ProjectName = "PEIPGWebPortal",
                    PublishProfile = "DeployTest.pubxml",
                    ProjectPath =
                        string.Concat(solutionPath,
                            EnumsExtender.GetDescription((Project) Enum.Parse(typeof (Project), "PEIPGWebPortal"))),
                    UserName = "",
                    Password = ""
                },
                new DeployableProject
                {
                    ProjectName = "PEIPGWS",
                    PublishProfile = "DeployTest.pubxml",
                    ProjectPath =
                        string.Concat(solutionPath,
                            EnumsExtender.GetDescription((Project) Enum.Parse(typeof (Project), "PEIPGWS"))),
                    UserName = "",
                    Password = ""
                },
                new DeployableProject
                {
                    ProjectName = "PinAdministrativeWS",
                    PublishProfile = "DeployTest.pubxml",
                    ProjectPath =
                        string.Concat(solutionPath,
                            EnumsExtender.GetDescription((Project) Enum.Parse(typeof (Project), "PinAdministrativeWS"))),
                    UserName = "",
                    Password = ""
                },
                new DeployableProject
                {
                    ProjectName = "PinCore",
                    PublishProfile = "DeployTest.pubxml",
                    ProjectPath =
                        string.Concat(solutionPath,
                            EnumsExtender.GetDescription((Project) Enum.Parse(typeof (Project), "PinCore"))),
                    UserName = "",
                    Password = ""
                },
                new DeployableProject
                {
                    ProjectName = "LogWS",
                    PublishProfile = "DeployTest.pubxml",
                    ProjectPath =
                        string.Concat(solutionPath,
                            EnumsExtender.GetDescription((Project) Enum.Parse(typeof (Project), "LogWS"))),
                    UserName = "",
                    Password = ""
                },
                new DeployableProject
                {
                    ProjectName = "ISOPayment",
                    PublishProfile = "DeployTest.pubxml",
                    ProjectPath =
                        string.Concat(solutionPath,
                            EnumsExtender.GetDescription((Project) Enum.Parse(typeof (Project), "ISOPayment"))),
                    UserName = "",
                    Password = ""
                },
                new DeployableProject
                {
                    ProjectName = "TMSWebSite",
                    PublishProfile = "DeployTest.pubxml",
                    ProjectPath =
                        string.Concat(solutionPath,
                            EnumsExtender.GetDescription((Project) Enum.Parse(typeof (Project), "TMSWebSite"))),
                    UserName = "",
                    Password = ""
                },
                new DeployableProject
                {
                    ProjectName = "MobileWS",
                    PublishProfile = "DeployTest.pubxml",
                    ProjectPath =
                        string.Concat(solutionPath,
                            EnumsExtender.GetDescription((Project) Enum.Parse(typeof (Project), "MobileWS"))),
                    UserName = "",
                    Password = ""
                },
                new DeployableProject
                {
                    ProjectName = "CustomerSTSWebSite",
                    PublishProfile = "DeployTest.pubxml",
                    ProjectPath =
                        string.Concat(solutionPath,
                            EnumsExtender.GetDescription((Project) Enum.Parse(typeof (Project), "CustomerSTSWebSite"))),
                    UserName = "",
                    Password = ""
                },
                new DeployableProject
                {
                    ProjectName = "ISOSTSWebSite",
                    PublishProfile = "DeployTest.pubxml",
                    ProjectPath =
                        string.Concat(solutionPath,
                            EnumsExtender.GetDescription((Project) Enum.Parse(typeof (Project), "ISOSTSWebSite"))),
                    UserName = "",
                    Password = ""
                },
                new DeployableProject
                {
                    ProjectName = "MerchantSTSWebSite",
                    PublishProfile = "DeployTest.pubxml",
                    ProjectPath =
                        string.Concat(solutionPath,
                            EnumsExtender.GetDescription((Project) Enum.Parse(typeof (Project), "MerchantSTSWebSite"))),
                    UserName = "",
                    Password = ""
                },
                new DeployableProject
                {
                    ProjectName = "PinSTSWebSite",
                    PublishProfile = "DeployTest.pubxml",
                    ProjectPath =
                        string.Concat(solutionPath,
                            EnumsExtender.GetDescription((Project) Enum.Parse(typeof (Project), "PinSTSWebSite"))),
                    UserName = "",
                    Password = ""
                }
            };
        }

        /// <summary>
        /// Gets project properties for Azure ERP server.
        /// </summary>
        /// <param name="solutionPath">Absolute path to solution folder.</param>
        /// <returns>List of all projects with their real properties.</returns>
        private static List<DeployableProject> AzureERPProjects(string solutionPath)
        {
            return new List<DeployableProject>
            {
                new DeployableProject
                {
                    ProjectName = "AdministrativeWS",
                    PublishProfile = "AdministrativeERP - Web Deploy.pubxml",
                    ProjectPath =
                        string.Concat(solutionPath,
                            EnumsExtender.GetDescription((Project) Enum.Parse(typeof (Project), "AdministrativeWS"))),
                },
                new DeployableProject
                {
                    ProjectName = "ClientCore",
                    PublishProfile = "ClientCoreERP - Web Deploy.pubxml",
                    ProjectPath =
                        string.Concat(solutionPath,
                            EnumsExtender.GetDescription((Project) Enum.Parse(typeof (Project), "ClientCore"))),
                },
                new DeployableProject
                {
                    ProjectName = "IsoCore",
                    PublishProfile = "IsoCoreERP - Web Deploy.pubxml",
                    ProjectPath =
                        string.Concat(solutionPath,
                            EnumsExtender.GetDescription((Project) Enum.Parse(typeof (Project), "IsoCore"))),
                },
                new DeployableProject
                {
                    ProjectName = "CustomerCore",
                    PublishProfile = "CustomerCoreERP - Web Deploy.pubxml",
                    ProjectPath =
                        string.Concat(solutionPath,
                            EnumsExtender.GetDescription((Project) Enum.Parse(typeof (Project), "CustomerCore"))),
                },
                new DeployableProject
                {
                    ProjectName = "CustomerWS",
                    PublishProfile = "CustomerWSERP - Web Deploy.pubxml",
                    ProjectPath =
                        string.Concat(solutionPath,
                            EnumsExtender.GetDescription((Project) Enum.Parse(typeof (Project), "CustomerWS"))),
                },
                new DeployableProject
                {
                    ProjectName = "eAccounts",
                    PublishProfile = "eAccountsERP - Web Deploy.pubxml",
                    ProjectPath =
                        string.Concat(solutionPath,
                            EnumsExtender.GetDescription((Project) Enum.Parse(typeof (Project), "eAccounts"))),
                },
                new DeployableProject
                {
                    ProjectName = "PBS_ERP_WebApi",
                    PublishProfile = "PBSERPWebApi - Web Deploy.pubxml",
                    ProjectPath =
                        string.Concat(solutionPath,
                            EnumsExtender.GetDescription((Project) Enum.Parse(typeof (Project), "PBS_ERP_WebApi"))),
                },
                new DeployableProject
                {
                    ProjectName = "PEIPGWebPortal",
                    PublishProfile = "PEIPGWebERP - Web Deploy.pubxml",
                    ProjectPath =
                        string.Concat(solutionPath,
                            EnumsExtender.GetDescription((Project) Enum.Parse(typeof (Project), "PEIPGWebPortal"))),
                },
                new DeployableProject
                {
                    ProjectName = "PEIPGWS",
                    PublishProfile = "PEIPGWSERP - Web Deploy.pubxml",
                    ProjectPath =
                        string.Concat(solutionPath,
                            EnumsExtender.GetDescription((Project) Enum.Parse(typeof (Project), "PEIPGWS"))),
                },
                new DeployableProject
                {
                    ProjectName = "PinAdministrativeWS",
                    PublishProfile = "PinAdministrativeERP - Web Deploy.pubxml",
                    ProjectPath =
                        string.Concat(solutionPath,
                            EnumsExtender.GetDescription((Project) Enum.Parse(typeof (Project), "PinAdministrativeWS"))),
                },
                new DeployableProject
                {
                    ProjectName = "PinCore",
                    PublishProfile = "PinCoreERP - Web Deploy.pubxml",
                    ProjectPath =
                        string.Concat(solutionPath,
                            EnumsExtender.GetDescription((Project) Enum.Parse(typeof (Project), "PinCore"))),
                },
                new DeployableProject
                {
                    ProjectName = "LogWS",
                    PublishProfile = "LogWSERP - Web Deploy.pubxml",
                    ProjectPath =
                        string.Concat(solutionPath,
                            EnumsExtender.GetDescription((Project) Enum.Parse(typeof (Project), "LogWS"))),
                },
                new DeployableProject
                {
                    ProjectName = "ISOPayment",
                    PublishProfile = "IsoPaymentERP - Web Deploy.pubxml",
                    ProjectPath =
                        string.Concat(solutionPath,
                            EnumsExtender.GetDescription((Project) Enum.Parse(typeof (Project), "ISOPayment"))),
                },
                new DeployableProject
                {
                    ProjectName = "TMSWebSite",
                    PublishProfile = "TMSERP - Web Deploy.pubxml",
                    ProjectPath =
                        string.Concat(solutionPath,
                            EnumsExtender.GetDescription((Project) Enum.Parse(typeof (Project), "TMSWebSite"))),
                },
                new DeployableProject
                {
                    ProjectName = "MobileWS",
                    PublishProfile = "MobileWSERP - Web Deploy.pubxml",
                    ProjectPath =
                        string.Concat(solutionPath,
                            EnumsExtender.GetDescription((Project) Enum.Parse(typeof (Project), "MobileWS"))),
                }
            };
        }
    }
}
